package statystyczne;

import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JTextField;

public class PRWindow extends JFrame {
	private static final long serialVersionUID = 6364060337601894635L;
	
	protected JButton b_Train;
	protected JButton b_deriveFS;
	protected JButton b_read;
	protected JComboBox<String> f_combo_PCA_LDA;
	protected JComboBox<String> f_combo_criterion;
	protected JRadioButton f_rb_extr;
	protected JRadioButton f_rb_sel;
	protected JButton jButton2;
	protected JButton jButtonExecute;
	protected JComboBox<String> jComboBox2;
	protected JLabel jLabel1;
	protected JLabel jLabel10;
	protected JLabel jLabel12;
	protected JLabel jLabel13;
	protected JLabel jLabel14;
	protected JLabel jLabel15;
	protected JLabel jLabel16;
	protected JLabel jLabel17;
	protected JLabel jLabel2;
	protected JLabel jLabel3;
	protected JLabel jLabel4;
	protected JLabel jLabel5;
	protected JLabel jLabel6;
	protected JLabel jLabel8;
	protected JLabel jLabel9;
	protected JLabel classResultLabel;
	protected JPanel jPanel2;
	protected JPanel jPanel3;
	protected JPanel jPanel4;
	protected JPanel jPanel5;
	protected JSeparator jSeparator1;
	protected JLabel l_FLD_val;
	protected JLabel l_FLD_winner;
	protected JLabel l_NewDim;
	protected JLabel l_dataset_name;
	protected JLabel l_dataset_name_l;
	protected JLabel l_nfeatures;
	protected ButtonGroup rbg_F;
	protected JComboBox<String> selbox_nfeat;
	protected JTextField tf_PCA_Energy;
	protected JTextField tf_TrainSetSize;
	protected JTextField kTextField;
	protected JRadioButton useTraceRadio;
	protected JRadioButton useMachalRadio;
	
	public PRWindow() {
		initComponents();
		setSize(720, 410);
	
	}
	
	private void initComponents() {
		rbg_F = new ButtonGroup();
		b_read = new JButton();
		jPanel2 = new JPanel();
		jLabel1 = new JLabel();
		l_dataset_name_l = new JLabel();
		jLabel3 = new JLabel();
		jLabel4 = new JLabel();
		l_dataset_name = new JLabel();
		l_nfeatures = new JLabel();
		jButton2 = new JButton();
		jPanel3 = new JPanel();
		jLabel5 = new JLabel();
		jLabel6 = new JLabel();
		selbox_nfeat = new JComboBox<>();
		jSeparator1 = new JSeparator();
		f_rb_extr = new JRadioButton();
		f_rb_sel = new JRadioButton();
		b_deriveFS = new JButton();
		jLabel10 = new JLabel();
		f_combo_criterion = new JComboBox<>();
		f_combo_PCA_LDA = new JComboBox<>();
		jLabel12 = new JLabel();
		tf_PCA_Energy = new JTextField();
		jLabel14 = new JLabel();
		jLabel15 = new JLabel();
		l_NewDim = new JLabel();
		jPanel4 = new JPanel();
		jLabel8 = new JLabel();
		jLabel9 = new JLabel();
		jComboBox2 = new JComboBox<>();
		b_Train = new JButton();
		jButtonExecute = new JButton();
		jLabel16 = new JLabel();
		tf_TrainSetSize = new JTextField();
		jLabel17 = new JLabel();
		jPanel5 = new JPanel();
		jLabel2 = new JLabel();
		l_FLD_winner = new JLabel();
		jLabel13 = new JLabel();
		l_FLD_val = new JLabel();
		useTraceRadio = new JRadioButton();
		useMachalRadio = new JRadioButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		getContentPane().setLayout(null);

		b_read.setText("Read dataset");
		getContentPane().add(b_read);
		b_read.setBounds(20, 10, 130, 25);

		jPanel2.setBackground(new java.awt.Color(204, 255, 255));
		jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

		jLabel1.setFont(new java.awt.Font("Comic Sans MS", 0, 18)); // NOI18N
		jLabel1.setText("Dataset info");

		l_dataset_name_l.setText("Name:");

		jLabel3.setText("Classes:");

		jLabel4.setText("Features:");

		l_dataset_name.setText("...");

		l_nfeatures.setText("...");

		javax.swing.GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
				javax.swing.GroupLayout.Alignment.TRAILING,
				jPanel2Layout
						.createSequentialGroup()
						.addContainerGap()
						.addGroup(
								jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
										.addGroup(jPanel2Layout.createSequentialGroup().addComponent(l_dataset_name_l).addGap(18, 18, 18).addComponent(l_dataset_name)).addComponent(jLabel1))
						.addGroup(
								jPanel2Layout
										.createParallelGroup(GroupLayout.Alignment.LEADING)
										.addGroup(jPanel2Layout.createSequentialGroup().addGap(115, 115, 115).addComponent(jLabel3))
										.addGroup(
												jPanel2Layout.createSequentialGroup().addGap(94, 94, 94).addComponent(jLabel4).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
														.addComponent(l_nfeatures))).addGap(100, 100, 100)));
		jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addGroup(
						jPanel2Layout
								.createSequentialGroup()
								.addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(jLabel3))
								.addGap(10, 10, 10)
								.addGroup(
										jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(l_dataset_name_l).addComponent(jLabel4).addComponent(l_dataset_name)
												.addComponent(l_nfeatures)).addContainerGap(24, Short.MAX_VALUE)));

		getContentPane().add(jPanel2);
		jPanel2.setBounds(10, 50, 320, 80);

		jButton2.setText("Parse dataset");
		getContentPane().add(jButton2);
		jButton2.setBounds(190, 10, 130, 25);

		jPanel3.setBackground(new Color(255, 255, 204));
		jPanel3.setBorder(BorderFactory.createEtchedBorder());
		jPanel3.setLayout(null);

		jLabel5.setFont(new java.awt.Font("Comic Sans MS", 0, 18)); // NOI18N
		jLabel5.setText("Feature space");
		jPanel3.add(jLabel5);
		jLabel5.setBounds(14, 2, 118, 26);

		jLabel6.setText("FS Dimension");
		jPanel3.add(jLabel6);
		jLabel6.setBounds(178, 9, 78, 16);

		selbox_nfeat.setModel(new DefaultComboBoxModel<String>(new String[] { "1" }));
		selbox_nfeat.setEnabled(true);
		jPanel3.add(selbox_nfeat);
		selbox_nfeat.setBounds(268, 6, 34, 22);
		jPanel3.add(jSeparator1);
		jSeparator1.setBounds(14, 41, 290, 10);

		f_rb_extr.setBackground(new Color(255, 255, 204));
		rbg_F.add(f_rb_extr);
		f_rb_extr.setText("Feature extraction");
		jPanel3.add(f_rb_extr);
		f_rb_extr.setBounds(10, 110, 133, 25);

		f_rb_sel.setBackground(new Color(255, 255, 204));
		rbg_F.add(f_rb_sel);
		f_rb_sel.setSelected(true);
		f_rb_sel.setText("Feature selection");
		jPanel3.add(f_rb_sel);
		f_rb_sel.setBounds(10, 60, 127, 25);

		b_deriveFS.setText("Derive Feature Space");
		jPanel3.add(b_deriveFS);
		b_deriveFS.setBounds(10, 190, 292, 25);

		jLabel10.setText("Criterion");
		jPanel3.add(jLabel10);
		jLabel10.setBounds(200, 50, 49, 16);

		f_combo_criterion.setModel(new DefaultComboBoxModel<String>(new String[] { "Fisher discriminant", "Classification error" }));
		f_combo_criterion.setEnabled(false);
		jPanel3.add(f_combo_criterion);
		f_combo_criterion.setBounds(160, 70, 140, 22);

		f_combo_PCA_LDA.setModel(new DefaultComboBoxModel<String>(new String[] { "PCA", "LDA" }));
		f_combo_PCA_LDA.setEnabled(false);
		jPanel3.add(f_combo_PCA_LDA);
		f_combo_PCA_LDA.setBounds(190, 110, 70, 22);

		jLabel12.setText("Energy");
		jPanel3.add(jLabel12);
		jLabel12.setBounds(20, 140, 39, 16);
		
		tf_PCA_Energy.setText("80");
		jPanel3.add(tf_PCA_Energy);
		tf_PCA_Energy.setBounds(70, 140, 30, 22);

		jLabel14.setText("%");
		jPanel3.add(jLabel14);
		jLabel14.setBounds(110, 140, 20, 16);

		jLabel15.setText("New dimension:");
		jPanel3.add(jLabel15);
		jLabel15.setBounds(160, 140, 92, 16);

		l_NewDim.setText("...");
		jPanel3.add(l_NewDim);
		l_NewDim.setBounds(270, 140, 30, 16);
		
		useTraceRadio.setBackground(new Color(255, 255, 204));
		useTraceRadio.setBounds(10, 170, 20, 15);
		jPanel3.add(useTraceRadio);
		
		JLabel traceLbl = new JLabel();
		traceLbl.setText("Use trace(...) instead of det(...)");
		traceLbl.setBounds(30, 170, 200, 16);
		traceLbl.setForeground(Color.RED);
		jPanel3.add(traceLbl);

		getContentPane().add(jPanel3);
		jPanel3.setBounds(10, 140, 320, 220);

		jPanel4.setBackground(new Color(204, 255, 204));
		jPanel4.setBorder(BorderFactory.createEtchedBorder());
		jPanel4.setLayout(null);

		jLabel8.setFont(new Font("Comic Sans MS", 0, 18)); // NOI18N
		jLabel8.setText("Classifier");
		jPanel4.add(jLabel8);
		jLabel8.setBounds(10, 0, 79, 26);

		jLabel9.setText("Method");
		jPanel4.add(jLabel9);
		jLabel9.setBounds(14, 44, 42, 16);

		jComboBox2.setModel(new DefaultComboBoxModel<String>(new String[] { "Nearest neighbor (NN)", "Nearest Mean (NM)", "k-Nearest Neighbor (k-NN)", "k-Nearest Mean (k-NM)" }));
		jPanel4.add(jComboBox2);
		jComboBox2.setBounds(74, 41, 178, 22);

		b_Train.setText("Train");
		jPanel4.add(b_Train);
		b_Train.setBounds(40, 130, 98, 25);

		jButtonExecute.setText("Execute");
		jPanel4.add(jButtonExecute);
		jButtonExecute.setBounds(210, 130, 96, 25);

		jLabel16.setText("Training part:");
		jPanel4.add(jLabel16);
		jLabel16.setBounds(20, 170, 80, 16);

		tf_TrainSetSize.setText("80");
		jPanel4.add(tf_TrainSetSize);
		tf_TrainSetSize.setBounds(110, 170, 20, 22);

		jLabel17.setText("%");
		jPanel4.add(jLabel17);
		jLabel17.setBounds(140, 170, 20, 16);

		getContentPane().add(jPanel4);
		jPanel4.setBounds(340, 150, 350, 210);

		jPanel5.setBorder(BorderFactory.createTitledBorder("Results"));
		jPanel5.setLayout(null);

		jLabel2.setText("FS Winner:");
		jPanel5.add(jLabel2);
		jLabel2.setBounds(10, 30, 70, 16);

		l_FLD_winner.setText("xxx");
		l_FLD_winner.setBounds(100, 30, 340, 16);
		jPanel5.add(l_FLD_winner);

		jLabel13.setText("FLD value: ");
		jPanel5.add(jLabel13);
		jLabel13.setBounds(10, 60, 70, 16);

		l_FLD_val.setText("vvv");
		jPanel5.add(l_FLD_val);
		l_FLD_val.setBounds(100, 60, 340, 16);

		getContentPane().add(jPanel5);
		jPanel5.setBounds(340, 10, 350, 130);
		
		kTextField = new JTextField();
		kTextField.setBounds(74, 84, 56, 20);
		jPanel4.add(kTextField);
		kTextField.setColumns(10);
		
		JLabel lblK = new JLabel("k");
		lblK.setBounds(63, 87, 11, 14);
		jPanel4.add(lblK);
		
		JLabel lblMachal = new JLabel("Mahalanobis distance");
		lblMachal.setBounds(150, 87, 150, 14);
		jPanel4.add(lblMachal);
		
		useMachalRadio.setBackground(new Color(204, 255, 204));
		useMachalRadio.setBounds(260, 87, 20, 15);
		jPanel4.add(useMachalRadio);
		
		JLabel lblTestRsults = new JLabel("Test results");
		lblTestRsults.setBounds(194, 171, 63, 14);
		jPanel4.add(lblTestRsults);
		
		classResultLabel = new JLabel("");
		classResultLabel.setBounds(267, 171, 46, 14);
		jPanel4.add(classResultLabel);
		
		JLabel label = new JLabel("%");
		label.setBounds(314, 171, 11, 14);
		jPanel4.add(label);
		

		pack();
	}
}
